Skip to content

feat: opt-in redact_output masks secrets in tool results - #94

Merged
blackaxgit merged 2 commits into
mainfrom
feat/redact-output
Dec 4, 2026
Merged

blackaxgit merged 2 commits into
mainfrom
feat/redact-output

Conversation

@blackaxgit

Copy link
Copy Markdown
Owner

Opt-in redact_output (default off). When on, execute, execute_on_group and converted ToolError text are passed through ssh_mcp.redact before they reach the MCP client (an LLM agent).

  • Masks: key=value / key: value secrets (password, pwd, secret*, token, api/access key, client secret; pass/passwd only with =), quoted values (escape-aware), Authorization / Bearer, URL passwords (login kept), PEM private keys (bounded at truncation marker / blank line / Exit code:).
  • Keeps: logins, e-mails, IPs, host names, PWD=/path.
  • Linear-time patterns (1 MiB adversarial corpus in tests), run via asyncio.to_thread.
  • Reviewed by a 3-model panel in two rounds; all findings fixed.

Tests: 1059 pass; tests/test_paths.py::test_ensure_root_refuses_group_or_world_accessible_root fails on main too in a umask-0077 shell (pre-existing, unrelated).

- New redact_output setting (default off): execute, execute_on_group and converted
  ToolError text pass through ssh_mcp.redact before returning to the client
- Masks passwords/tokens/keys (key=value, quoted, Authorization, Bearer, URL
  password, PEM blocks); logins, e-mails, IPs and host names stay visible
- Linear-time rules, run off the event loop; documented in README, CHANGELOG and
  servers.example.toml
@blackaxgit
blackaxgit merged commit b50584d into main Dec 4, 2026
9 checks passed
@blackaxgit
blackaxgit deleted the feat/redact-output branch December 4, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant